<?	
	/* Se asegura que el archivo es incluido por el index */
		defined( 'LOAD_MODULE_ACTION' ) or die( 'No esta permitido el acceso directo a ' . __FILE__ );  		
	/* Cuando se hace el include del archivo automaticamente crea un objeto y lo guarda en una variable temporal */
		$this->oTmpObject = new Menu_arm( $this );
	
	class Menu_arm extends Arm
	{
	function Menu_arm( &$oModule )
		{
			$this->Arm( $oModule );
		// Crea el Objeto del Tab
			$ncMenu = getParam('ncMenu');
			$this->oTab->addTab ( 'Datos' , 1 );
			if ( $ncMenu ) 
			{
				list($nModo, $nVista) = $this->oDatabase->getArray($cSql = "SELECT nModo, nVista FROM gtMenu WHERE ncMenu= " . $ncMenu );
				if ( $nModo  == 2  || $nModo  == 3) 
				{
					$this->oTab->addTab ( 'Contenido', 2 );
					if ( $nModo  == 2  ) 
					{
						if ( $nVista  != 0  && $nVista  != 2  ) $this->oTab->addTab ( 'Panel izquierdo', 4 , '', 'nPanel=1');
						$this->oTab->addTab ( 'Panel centro', 8 , '', 'nPanel=2');
						if ( $nVista  != 0  && $nVista  != 1  ) $this->oTab->addTab ( 'Panel derecho', 10 , '', 'nPanel=3');
					}
				}
				$this->oTab->addTab ( 'Submenues', 6 );
			}
		}
		
	function make($bFiles )
		{
				$aClases = array(1 => "menu_frm", 2 => "menu_contenido_lst" , 6=> "menu_lst" , 4=> "menu_componente_lst" , 8=> "menu_componente_lst"  ,10=> "menu_componente_lst"  );
				$bRefresh = getParam('bRefresh');
				//$this->oModule->setTarget( $this->cClass );
				if ( $bFiles )
				{	
					$nSelect = array_search(getParam(PARAM_CLASS) ,$aClases);
				} elseif ( $bRefresh  != '1' )
				{			
				// Muestra el Tab
					$this->oTab->make();
				// Muestra el tab Seleccionado
					echo "<div class=\"tab_contenido\">";
					$nSelect = $this->oTab->getValue();
				}
				$cClase = $aClases[$nSelect ];
				switch( $nSelect ) 
				{
					case 1:
						echo "<div  url='" . $this->oTab->getTabUrl($nSelect ) . "&amp;bRefresh=1'  id=\"$cClase\">";
						$oClass = $this->oModule->loadClass( $cClase );
						$oClass->makeFrm();
					break;
					case 4:
					case 8:
					case 10:
						$nPanel  = $nSelect == 4?1 :$nSelect == 8 ? 2:3;
						echo "<div  url='" . $this->oTab->getTabUrl($nSelect ) . "&amp;nPanel=$nPanel&amp;bRefresh=1'  id=\"$cClase\">";
						$oClass = $this->oModule->loadClass( $cClase );
						$oClass->aFields['ncMenu'] = getParam( 'ncMenu') ;
						$oClass->makeLst();
					break;
					case 6:
						echo "<div  url='" . $this->oTab->getTabUrl($nSelect ) . "&amp;bRefresh=1'  id=\"$cClase\">";
						$oClass = $this->oModule->loadClass( $cClase );
						$oClass->aFields['ncMenuPadre'] = getParam( 'ncMenu') ;
						$oClass->makeLst();
					break;
					case 2:
					case 3:
						echo "<div  url='" . $this->oTab->getTabUrl($nSelect ) . "&amp;bRefresh=1'  id=\"$cClase\">";
						$oClass = $this->oModule->loadClass( $cClase );
						$oClass->aFields['ncMenu'] = getParam( 'ncMenu') ;
						$oClass->makeLst();
					break;
				}
		echo "</div>";
		if ( $bRefresh  != '1' && !$bFiles ) echo "</div>";
		}
	}
?>